 

package com.zdkj.subway.stm.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdkj.common.core.util.R;
import com.zdkj.common.log.annotation.SysLog;
import com.zdkj.subway.stm.entity.SwStMarketingTicketOffineSell;
import com.zdkj.subway.stm.service.SwStMarketingTicketOffineSellService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 线下正常售卖售票员
 *
 * @author songtuo
 * @date 2020-07-11 21:43:57
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swstmarketingticketoffinesell" )
@Api(value = "swstmarketingticketoffinesell", tags = "线下正常售卖售票员管理")
public class SwStMarketingTicketOffineSellController {

    private final  SwStMarketingTicketOffineSellService swStMarketingTicketOffineSellService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param swStMarketingTicketOffineSell 线下正常售卖售票员
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwStMarketingTicketOffineSellPage(Page page, SwStMarketingTicketOffineSell swStMarketingTicketOffineSell) {
        return R.ok(swStMarketingTicketOffineSellService.page(page, Wrappers.query(swStMarketingTicketOffineSell)));
    }


    /**
     * 通过id查询线下正常售卖售票员
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(swStMarketingTicketOffineSellService.getById(id));
    }

    /**
     * 新增线下正常售卖售票员
     * @param swStMarketingTicketOffineSell 线下正常售卖售票员
     * @return R
     */
    @ApiOperation(value = "新增线下正常售卖售票员", notes = "新增线下正常售卖售票员")
    @SysLog("新增线下正常售卖售票员" )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('generator_swstmarketingticketoffinesell_add')" )
    public R save(@RequestBody SwStMarketingTicketOffineSell swStMarketingTicketOffineSell) {
        return R.ok(swStMarketingTicketOffineSellService.save(swStMarketingTicketOffineSell));
    }

    /**
     * 修改线下正常售卖售票员
     * @param swStMarketingTicketOffineSell 线下正常售卖售票员
     * @return R
     */
    @ApiOperation(value = "修改线下正常售卖售票员", notes = "修改线下正常售卖售票员")
    @SysLog("修改线下正常售卖售票员" )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('generator_swstmarketingticketoffinesell_edit')" )
    public R updateById(@RequestBody SwStMarketingTicketOffineSell swStMarketingTicketOffineSell) {
        return R.ok(swStMarketingTicketOffineSellService.updateById(swStMarketingTicketOffineSell));
    }

    /**
     * 通过id删除线下正常售卖售票员
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除线下正常售卖售票员", notes = "通过id删除线下正常售卖售票员")
    @SysLog("通过id删除线下正常售卖售票员" )
    @DeleteMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('generator_swstmarketingticketoffinesell_del')" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(swStMarketingTicketOffineSellService.removeById(id));
    }

}
